package com.foreveross.proxyip.web.action.monitor;

import java.util.List;

import javax.inject.Inject;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.stereotype.Controller;

import com.foreveross.proxyip.application.monitor.ChannelApplication;
import com.foreveross.proxyip.application.monitor.HistorySearchApplication;
import com.foreveross.proxyip.infra.PageData;
import com.foreveross.proxyip.monitor.vo.ChannelEntityVO;
import com.foreveross.proxyip.monitor.vo.HistoryIpEntityVO;
import com.foreveross.proxyip.monitor.vo.RetrieveIpEntityVO;
import com.foreveross.proxyip.web.action.BaseAction;
/**
 * 历史检索库Action
 * @author Administrator
 *
 */
@SuppressWarnings("serial")
@Controller
@org.springframework.context.annotation.Scope("prototype")
@Namespace("/monitor/historySearch")
@ParentPackage("json-default")
public class HistorySearchAction extends BaseAction{

	@Inject
	HistorySearchApplication historyApplication;
	@Inject
	private ChannelApplication channelApplication;
	private HistoryIpEntityVO  c;
	private PageData pageData;
	private int pageLen;
	private int pageIndex;
	private List<ChannelEntityVO> channels;
	
	
	
	
	@Action(value="toJsp",results={@Result(name="dispatcher", type="dispatcher",location="/monitor/historySearch.jsp")})
	public String toJsp()throws Exception{
		this.channels=channelApplication.getAllChannels();
		return "dispatcher";
	}
	
	
	/**
	 * 检索（按某些条件）
	 * @return
	 */
	@Action(value="search", results={@Result(name="JSON", type="json", params={"root","pageData"})})
	public String search()throws Exception{
		this.pageData=historyApplication.searchByConditions(c,this.pageIndex,this.pageLen);
		return "JSON";
	}


	public HistorySearchApplication getHistoryApplication() {
		return historyApplication;
	}


	public void setHistoryApplication(HistorySearchApplication historyApplication) {
		this.historyApplication = historyApplication;
	}


	public ChannelApplication getChannelApplication() {
		return channelApplication;
	}


	public void setChannelApplication(ChannelApplication channelApplication) {
		this.channelApplication = channelApplication;
	}


	public HistoryIpEntityVO getC() {
		return c;
	}


	public void setC(HistoryIpEntityVO c) {
		this.c = c;
	}


	public PageData getPageData() {
		return pageData;
	}


	public void setPageData(PageData pageData) {
		this.pageData = pageData;
	}


	public int getPageLen() {
		return pageLen;
	}


	public void setPageLen(int pageLen) {
		this.pageLen = pageLen;
	}


	public int getPageIndex() {
		return pageIndex;
	}


	public void setPageIndex(int pageIndex) {
		this.pageIndex = pageIndex;
	}


	public List<ChannelEntityVO> getChannels() {
		return channels;
	}


	public void setChannels(List<ChannelEntityVO> channels) {
		this.channels = channels;
	}
	
	
	
	
}
